<!-- saved from url=(0014)about:internet -->
<html lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>${title}</title>
<script src="AC_OETags.js" language="javascript"></script>
<style>
body { margin: 0px; overflow:hidden }
</style>
<script language="JavaScript" type="text/javascript">
<!--
// -----------------------------------------------------------------------------
// Globals
// Major version of Flash required
var requiredMajorVersion = ${version_major};
// Minor version of Flash required
var requiredMinorVersion = ${version_minor};
// Minor version of Flash required
var requiredRevision = ${version_revision};
// -----------------------------------------------------------------------------
// -->
</script>
</head>

<body scroll="no" onload="load()" onunload="GUnload()" onResize="windowResized()">
<div style="background-color:white;left: 100px; top: 10px; width: 1024px; height: 650px;">
<div id="flex-control" style="z-index:2; visibility:visible;position:relative; top: 25px; left: 20px; height: 250px;">
<script src="http://maps.google.com/maps?file=api&amp;v=2.x&amp;key=ABQIAAAAUnY6UsCW7it4ynNVu1Y5yBSDQ6aNM_7BFJCPhqxicMOt6zwx1RRtVCdEE4xPQE1d76BQv-4aw_CbIg" type="text/javascript"></script>
<script language="JavaScript" type="text/javascript" src="history.js"></script>
<script language="JavaScript" type="text/javascript">
<!--
// Version check for the Flash Player that has the ability to start Player Product Install (6.0r65)
var hasProductInstall = DetectFlashVer(6, 0, 65);

// Version check based upon the values defined in globals
var hasRequestedVersion = DetectFlashVer(requiredMajorVersion, requiredMinorVersion, requiredRevision);


// Check to see if a player with Flash Product Install is available and the version does not meet the requirements for playback
if ( hasProductInstall && !hasRequestedVersion ) {
	// MMdoctitle is the stored document.title value used by the installation process to close the window that started the process
	// This is necessary in order to close browser windows that are still utilizing the older version of the player after installation has completed
	// DO NOT MODIFY THE FOLLOWING FOUR LINES
	// Location visited after installation is complete if installation is required
	var MMPlayerType = (isIE == true) ? "ActiveX" : "PlugIn";
	var MMredirectURL = window.location;
    document.title = document.title.slice(0, 47) + " - Flash Player Installation";
    var MMdoctitle = document.title;

	AC_FL_RunContent(
		"src", "playerProductInstall",
		"FlashVars", "MMredirectURL="+MMredirectURL+'&MMplayerType='+MMPlayerType+'&MMdoctitle='+MMdoctitle+"",
		"width", "${width}",
		"height", "${height}",
		"align", "middle",
		"id", "flexRuutr",
		"quality", "high",
		"bgcolor", "${bgcolor}",
		"name", "flexRuutr",
		"wmode", "transparent",
		"allowScriptAccess","sameDomain",
		"type", "application/x-shockwave-flash",
		"pluginspage", "http://www.adobe.com/go/getflashplayer"
	);
} else if (hasRequestedVersion) {
	// if we've detected an acceptable version
	// embed the Flash Content SWF when all tests are passed
	AC_FL_RunContent(
			"src", "${swf}",
			"width", "${width}",
			"height", "${height}",
			"align", "middle",
			"id", "flexRuutr",
			"quality", "high",
			"bgcolor", "${bgcolor}",
			"name", "flexRuutr",
			"flashvars",'historyUrl=history.htm%3F&lconid=' + lc_id + '',
			"allowScriptAccess","sameDomain",
			"wmode", "transparent",
			"type", "application/x-shockwave-flash",
			"pluginspage", "http://www.adobe.com/go/getflashplayer"
	);
  } else {  // flash is too old or we can't detect the plugin
    var alternateContent = '<img src="http://note19.wordpress.com/files/2007/11/flex.png"><br/>'
  	+ 'This content requires the Adobe Flash Player. '
   	+ '<a href=http://www.adobe.com/go/getflash/>Get Flash</a>';
    document.write(alternateContent);  // insert non-flash content
  }
  
 //************** DEFINE THE GPX DATA SOURCE + TITLE FOR THE ROUTE ***************************
  		var gpxUrl = "http://javey.net/bike/gpx/24-nov-2007.gpx";
  		var gpxTitle = "Los Gatos, Sheldon Road Bike Trail"
  		var gpxDistance = 10;
 //*******************************************************************************************
  		var map;
		var marker;
		var autoResize = false;
		
		function showMap(flag) {
			if(flag)
				document.getElementById("googlemap").style.visibility = "visible";
			else
				document.getElementById("googlemap").style.visibility = "hidden";
		}

		
		function centerMap(lat, lng) {
			var currentPoint = new GLatLng(lat, lng);
			if (marker != null) {
				map.removeOverlay(marker);
			}
	        map.panTo(currentPoint);
	        marker = new GMarker(currentPoint);
	        map.addOverlay(marker);
		}
		
		function resizeMap(width, height) {
			document.getElementById("googlemap").style.width = width;
			document.getElementById("googlemap").style.height = height;
		}
		
		function gup(name) {
		  name = name.replace(/[\[]/,"\\\[").replace(/[\]]/,"\\\]");
		  var regexS = "[\\?&]"+name+"=([^&#]*)";
		  var regex = new RegExp(regexS);
		  var results = regex.exec(window.location.href);
		  if (results == null)
		    return "";
		  else
		    return results[1];
		}

		function initMap(width, height) {
			map = new GMap2(document.getElementById("googlemap"));
			var bottomRight = new GControlPosition(G_ANCHOR_BOTTOM_RIGHT, new GSize(10,10));
			map.addControl(new GLargeMapControl(), bottomRight);
			map.addControl(new GMapTypeControl());
			map.addControl(new FlexControl());
	        map.setCenter(new GLatLng(37.225334784, -121.987610897), 12);
			//map.setMapType(G_SATELLITE_MAP);
			// display the map
			resizeMap(width, height);
			showMap(true);			
		}
		
		function getGpxUrl() {
			flexRuutr.setDataSource(gpxUrl, gpxTitle);
		}
		
		function getGpxDistance() {
			flexRuutr.setDistance(gpxDistance);
		}
		
		function load() {
		   	var gpx = gup("gpx")
   			gpxUrl = (gpx == "") ? gpxUrl : gpx;
   			var title = gup("title");
   			gpxTitle = (title == "") ? gpxTitle : title;
   			var resize = gup("resize");
   			autoResize = (resize=="1") ? true : false;
		   if (GBrowserIsCompatible()) {
		   		setViewport();
		   		initMap(viewportwidth, viewportheight);
		   		try {		   			
				    var request = GXmlHttp.create();
					request.open("GET", gpxUrl, true);
					request.onreadystatechange = function() {
						if (request.readyState == 4) {
							var xmlDoc = null;
							var textLength = parseFloat(request.responseText.length);
							if (textLength > 0) {
								xmlDoc = GXml.parse(request.responseText);
							} else {
								xmlDoc = request.responseXML;
							}
							var points = xmlDoc.documentElement.getElementsByTagName("trkpt");
							var track = new Array();
							for (var i = 0; i < points.length; i++) {
						  		var point = new GPoint(parseFloat(points[i].getAttribute("lon")), parseFloat(points[i].getAttribute("lat")));
				  				track.push(point);
							}
							var p = new GPolyline(track);
							map.addOverlay(p);
							gpxDistance = p.getLength();
							var bnd = xmlDoc.documentElement.getElementsByTagName("bounds");
							var sw = new GLatLng(bnd[0].getAttribute("minlat"), bnd[0].getAttribute("minlon"));
						    var ne = new GLatLng(bnd[0].getAttribute("maxlat"), bnd[0].getAttribute("maxlon"));
						    var bounds = new GLatLngBounds(sw, ne);		
						    map.setCenter(bounds.getCenter(), 12);
						} 
					}
				
					// Send the request for data			
					request.send(null);
				} catch (exception) {
					//alert("Unable to use GXmlHttp: " + exception);
				}
		   }
	    }
	    
	    function FlexControl() {}
	    FlexControl.prototype = new GControl();
	    FlexControl.prototype.initialize = function(map) {
		  var container = document.createElement("div");
		  var chartDiv = document.createElement("div");
		  this.setButtonStyle_(chartDiv);
		  container.appendChild(chartDiv);
		  chartDiv.appendChild(document.createTextNode("Show/Hide Elevation Chart"));
		  GEvent.addDomListener(chartDiv, "click", function() {
		    var chart = document.getElementById("flex-control").style.visibility;
		    document.getElementById("flex-control").style.visibility = (chart == "hidden")? "visible" : "hidden";
		  });
		
		  map.getContainer().appendChild(container);
		  return container;
		}
	    
	    FlexControl.prototype.getDefaultPosition = function() {
		  return new GControlPosition(G_ANCHOR_TOP_LEFT, new GSize(20, 2));
		}
	    
	    FlexControl.prototype.setButtonStyle_ = function(button) {
		  button.style.textDecoration = "underline";
		  button.style.color = "#0000cc";
		  button.style.backgroundColor = "white";
		  button.style.font = "small Arial";
		  button.style.border = "1px solid black";
		  button.style.padding = "2px";
		  button.style.marginBottom = "1px";
		  button.style.textAlign = "center";
		  button.style.width = "220px";
		  button.style.cursor = "pointer";
		}
	    
	var viewportwidth = 1024;
	var viewportheight = 650;
	    
// -->
</script>
<noscript>
  	<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000"
			id="flexRuutr" width="${width}" height="${height}"
			codebase="http://fpdownload.macromedia.com/get/flashplayer/current/swflash.cab">
			<param name="movie" value="${swf}.swf" />
			<param name="quality" value="high" />
			<param name="bgcolor" value="${bgcolor}" />
			<param name="wmode" value="transparent">
			<param name="allowScriptAccess" value="sameDomain" />
			<embed src="${swf}.swf" quality="high" bgcolor="${bgcolor}" wmode="transparent" 
				width="${width}" height="${height}" name="flexRuutr" align="middle"
				play="true"
				loop="false"
				quality="high"
				allowScriptAccess="sameDomain"
				type="application/x-shockwave-flash"
				pluginspage="http://www.adobe.com/go/getflashplayer">
			</embed>
	</object>
</noscript>
</div>
<div id="googlemap" style="visibility:visible;background-color:white; z-index:1; top: -250px; position:relative; width: 100%; height: 100%;">
</div>
</div>
<iframe name="_history" src="history.htm" frameborder="0" scrolling="no" width="22" height="0"></iframe>
<script>
function windowResized() {
	if (autoResize) {
		setViewport();
		resizeMap(viewportwidth, viewportheight);
	}
}

function setViewport() { 
	 // the more standards compliant browsers (mozilla/netscape/opera/IE7) use window.innerWidth and window.innerHeight
	 if (autoResize == false) return;
	 
	 if (typeof window.innerWidth != 'undefined')
	 {
	      viewportwidth = window.innerWidth,
	      viewportheight = window.innerHeight
	 }
	 
	// IE6 in standards compliant mode (i.e. with a valid doctype as the first line in the document)
	
	 else if (typeof document.documentElement != 'undefined'
	     && typeof document.documentElement.clientWidth !=
	     'undefined' && document.documentElement.clientWidth != 0)
	 {
	       viewportwidth = document.documentElement.clientWidth,
	       viewportheight = document.documentElement.clientHeight
	 }
	 
	 // older versions of IE
	 
	 else
	 {
	       viewportwidth = document.getElementsByTagName('body')[0].clientWidth,
	       viewportheight = document.getElementsByTagName('body')[0].clientHeight
	 }
 }
</script>
</body>
</html>
